#

| Chapter 9 Saving Time on the Command Line |

## 9.4 Use Wildcards to Create Files?

The shells' `[]` (square bracket) wildcards will match a range of files. For instance, if you have files named afile, bfile, cfile, and dfile, you can print the first three by typing:

>     % lpr [a-c]file

Now, let's say that you want to create some more files called efile, ffile, gfile, and hfile. What's wrong with typing the command line below? Try it. Instead of vi, you can use your favorite editor or the touch (21.7) command:

>     % vi [e-h]file   Doesn't make those four files
>     % ls
>     afile   bfile   cfile   dfile

Stumped? Take a look at article 1.16 about wildcard matching.

The answer: wildcards can't match names that don't exist yet. That's especially true with a command like `touch ?file` (21.7) or `touch *file`-think how many filenames those wildcards could possibly create!

Article 9.5 explains shell `{ }` operators that solve this problem.

- JP

9.3 Reprinting Your Command Line with CTRL-r |  | 9.5 Build Strings with { }